<?php 
define('_VIEW_MODEL_','admin');
session_start();
$statu = $_SESSION['statu'];
require_once("../init.php");
if(!isset($act)){
	$act = "";
}
$where = "where userid != '0' and column1!='0'";
if(!$statu){
	echo "<script>window.parent.location.href='./index.php'</script>";
}
if(isset($act)&&$act=="admin"){
	$where = "where userid='1' ";
}
if(isset($act)&&$act=="book"){
	$where = "where column1='0' and userid != '1' ";
}
if(isset($act)&&$act=="bookid"){
	$id = intval($id);
	$where = "where column1='0' and column2='$id' and userid != '1' ";
}
if(isset($action)&&$action == "upcont"){
	$id = intval($id);
	$va = intval($val);
	$nu = $va==0?1:0;
	$db->Execute("update {$telper}bbs_cont set state = $nu where id=$id");
}
if(isset($page)){
		$page = intval($page);
	}else{
		$page = 1;
	}
$stat = ($page-1)*$adminusernum;
$num  = $db->GetRow("select count(id) from {$telper}bbs_cont $where");
$rs= $db->Execute("select * from {$telper}bbs_cont $where order by created desc");
if(!empty($rs)){
	$bbsinfo = $rs->GetArray();
}else{
	$bbsinfo = false;
}
$pageObj = new Page($num['count(id)'],$adminusernum,$smartyObj);
$smartyObj->assign('title',$admintitle);
$smartyObj->assign('adminbbstitle',$adminbbstitle);
$smartyObj->assign("act",$act);
$smartyObj->assign('bbsinfo',$bbsinfo);
$smartyObj->display("bbscont.tpl");
?>